package com.shrcl.engineerprocess.web.engineerproject.client.workbench;

import com.shrcl.engineerprocess.web.shared.workbench.UIProjectMoney
import static extension com.uniquesoft.gwt.shared.extensions.NumberExtensions.*
class Moneys {
	
	def static Double sum(Iterable<UIProjectMoney> aLotOfMoney){
		aLotOfMoney.map[hostAmount].reduce[Double d1, Double d2|d1+d2].nullsafe
	}
	
	def static String sumInfo(Iterable<UIProjectMoney> aLotOfMoney){
		aLotOfMoney.map[hostAmount].reduce[Double d1, Double d2|d1+d2].nullsafe.asCurrencyString
	}

	def static String sumBareInfo(Iterable<UIProjectMoney> aLotOfMoney){
		aLotOfMoney.map[hostAmount].reduce[Double d1, Double d2|d1+d2].nullsafe.asBareCurrencyString
	}
	
}